package com.salton123.utils;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.salton123.GlideApp;
import com.salton123.log.XLog;
import com.salton123.soulove.app.BuildConfig;
import com.salton123.soulove.app.R;

/**
 * User: newSalton@outlook.com
 * Date: 2019-08-04 12:46
 * ModifyTime: 12:46
 * Description:
 */
public class ImageLoader {

    public static void loadCircleCrop(ImageView imageView, String url) {
        if (BuildConfig.APP_DEVELOP) {
            XLog.d(ImageLoader.class, "[loadCenterInsideRoundedCorners] url:" + url);
        }

        GlideApp.with(imageView)
            .load(url)
            .centerInside()
            .placeholder(R.drawable.salton_load_pic)
            .circleCrop()
            .into(imageView);
    }

    public static void loadCenterCrop(ImageView imageView, String url) {
        if (BuildConfig.APP_DEVELOP) {
            XLog.d(ImageLoader.class, "[loadCenterCrop]" + ",url:" + url);
        }
        GlideApp.with(imageView)
            .load(url)
            .fitCenter()
            .into(imageView);
    }

    public static void loadImage(ImageView view,String url){
        Glide.with(view).load(url)
            .centerCrop()
            .thumbnail(0.3f)
            .placeholder(R.drawable.ic_placeholder)
            .into(view);
    }
}
